#include <map>
#include <string>
#include "mesh.h"
#include "MeshCache.h"

using namespace std;

Mesh* MeshCache::getMesh(string filepath){
	map<string, Mesh *>::iterator it;
	it = MeshMap.find(filepath);

	if (it == MeshMap.end()){
		char *fN = (char*)filepath.c_str();
		Mesh* m = new Mesh(fN);
		MeshMap.insert(pair<string, Mesh *>(filepath, m));
		return m;
	}
	return it->second;
}
MeshCache *MeshCache::instance = NULL;